import request from '@/utils/request'

// 接口根路径
const baseURL = import.meta.env.VITE_APP_BASE_API;
// 接口路径
export const apiUrl = {
  // 下载excel模板
  downloadExcel: '/base/product/downloadExcel',

  // 导入砖混结构参数信息
  uploadPobStructure: baseURL + '/bacInformation/uploadPobStructure',
  // 导入钢筋混凝土参数信息
  uploadRcpInformation: baseURL + '/bacInformation/uploadRcpInformation',
  // 导入高层建筑参数信息
  uploadHbpInformation: baseURL + '/bacInformation/uploadHbpInformation',
  // 导入概率地震易损性分析数据
  uploadPsaData: baseURL + '/bacInformation/uploadPsaData',

  // 单个导入易损性矩阵信息
  uploadSingleBvInformation: baseURL + '/bacInformation/uploadSingleBvInformation',
  // 批量导入易损性矩阵信息
  uploadBvInformation: baseURL + '/bacInformation/uploadBvInformation',
  // 单个导入易损性曲线信息
  uploadSingleBvInformationCurve: baseURL + '/bacInformation/uploadSingleBvInformationCurve',
  // 批量导入易损性曲线信息
  uploadBvInformationCurve: baseURL + '/bacInformation/uploadBvInformationCurve',
}

// 导入砖混结构参数信息
export function uploadPobStructure(data) {
  return request({
    url: apiUrl.uploadPobStructure,
    method: 'post',
    data: data
  })
}

// 导入钢筋混凝土参数信息
export function uploadRcpInformation(data) {
  return request({
    url: apiUrl.uploadRcpInformation,
    method: 'post',
    data: data
  })
}

// 导入高层建筑参数信息
export function uploadHbpInformation(data) {
  return request({
    url: apiUrl.uploadHbpInformation,
    method: 'post',
    data: data
  })
}

// 导入概率地震易损性分析数据
export function uploadPsaData(data) {
  return request({
    url: apiUrl.uploadPsaData,
    method: 'post',
    data: data
  })
}

// 建筑物区域特征信息修改
export function updateBacInformation(data) {
  return request({
    url: '/bacInformation/updateBacInformation',
    method: 'post',
    data: data
  })
}
// 建筑物区域特征信息删除
export function deleteBacInformation(query) {
  return request({
    url: '/bacInformation/deleteBacInformation',
    method: 'get',
    params: query
  })
}
// 建筑物区域特征信息修改回显
export function queryBacInformationById(query) {
  return request({
    url: '/bacInformation/queryBacInformationById',
    method: 'get',
    params: query
  })
}

// 建筑物区域特征信息分页查询
export function queryBacInformation(query) {
  return request({
    url: '/bacInformation/queryBacInformation',
    method: 'get',
    params: query
  })
}

// 导入建筑物易损性信息（易损性矩阵单个导入）
export function uploadSingleBvInformation(data) {
  return request({
    url: apiUrl.uploadSingleBvInformation,
    method: 'post',
    data: data
  })
}
// 导入建筑物易损性信息（易损性矩阵批量导入）
export function uploadBvInformation(data) {
  return request({
    url: apiUrl.uploadBvInformation,
    method: 'post',
    data: data
  })
}
// 导入建筑物易损性信息（易损性曲线单个导入）
export function uploadSingleBvInformationCurve(data) {
  return request({
    url: apiUrl.uploadSingleBvInformationCurve,
    method: 'post',
    data: data
  })
}
// 导入建筑物易损性信息（易损性曲线批量导入）
export function uploadBvInformationCurve(data) {
  return request({
    url: apiUrl.uploadBvInformationCurve,
    method: 'post',
    data: data
  })
}

// 添加易损性矩阵信息
export function saveBvInformation(data) {
  return request({
    url: '/bacInformation/saveBvInformation',
    method: 'post',
    data: data,
    // 参数结构
    // data: {
    //   "cbvInfoEntity": {}, 
    //   "cbvInfoMatrixValueList": [{}] 
    // }
  })
}
// 添加易损性曲线信息
export function saveBvInformationCurve(data) {
  return request({
    url: '/bacInformation/saveBvInformationCurve',
    method: 'post',
    data: data,
    // 参数结构
    // data: {
    //   "cbvInfoEntity": {}, 
    //   "cbvInfoValueList": [{}] 
    // }
  })
}
// 移入/出基础库
export function moveBasicLibraryApi(data) {
  return request({
    url: '/bacInformation/moveBasicLibrary',
    method: 'post',
    data,
  })
}
// 移入出基础库
export function queryMoveBasicLibraryApi(data) {
  return request({
    url: '/bacInformation/confirmMoveIn',
    method: 'post',
    data,
  })
}
// 查询易损性矩阵信息
export function queryBvInformationApi(params) {
  return request({
    url: '/bacInformation/getBacInfoById',
    method: 'get',
    params,
    // 参数结构
    // params: {
    //   "id": "9bf4719c8d804cd48a70504d751fd26c",
    // }
  })
}
// 导出易损性矩阵信息
export function exportExcelBvInfoApi(params) {
  return request({
    url: '/bacInformation/exportExcel',
    method: 'get',
    params,
    // 参数结构
    // params: {
    //   "id": "",
    //   "type": ""
    // },
    // 数据格式
    responseType: 'blob'
  })
}
// 修改建筑物区域特征信息--建筑物区域特征信息维护
export function updateBuildingAreaInfoApi(data) {
  return request({
    url: 'bacInformation/updateBuildingArea',
    method: 'post',
    data,
    // 参数结构
    // data: {
    //   "cbviId": "",
    //   "use0": "",
    //   "use1": "",
    //   "cs": "",
    //   "years": "",
    //   "info": "",
    //   "matrixParam": [
    //     {
    //       "cbviValueId": 1,
    //       "basicallyIntact": 1,
    //       "minorDamage": 1,
    //       "moderateDamage": 1,
    //       "seriousDamage": 1,
    //       "collapse": 1
    //     }
    //   ]
    // }
  })
}